//
//  BeforeLoginViewController.m
//  Molian
//
//  Created by xiaocankeji on 16/5/4.
//  Copyright © 2016年 xiaocan. All rights reserved.
//

#import "BeforeLoginViewController.h"
#import "LoginViewController.h"
#import "RecommendViewController.h"
#import "RegisterViewController.h"

@interface BeforeLoginViewController ()
@property (nonatomic, strong)UIImageView *hintImgView;
@end

@implementation BeforeLoginViewController

- (void)viewDidLoad {
    [super viewDidLoad];
     [self foundhintImgView];
    [self.view addSubview:self.hintImgView];
    // Do any additional setup after loading the view.
}
- (void)foundhintImgView
{
    //新增
    self.hintImgView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, DeviceWidth, DeviceHeight)];
    self.hintImgView.userInteractionEnabled = YES;
  //  self.hintImgView.contentMode = UIViewContentModeScaleAspectFit;
    self.hintImgView.image = [UIImage imageNamed:@"背景图"];
    //    [[UIApplication sharedApplication].delegate.window addSubview:self.hintImgView];
    
    
    UIImageView *imgV = [[UIImageView alloc] initWithFrame:CGRectMake(DeviceWidth/2 - 152/2 , DeviceHeight/2 - 51/2 - 50, 152, 51)];
    imgV.image = [UIImage imageNamed:@"闪屏-文字"];
    [self.hintImgView addSubview:imgV];
    
    
    UIButton *strollBt = [UIButton buttonWithType:UIButtonTypeCustom];
    strollBt.frame = CGRectMake(20, DeviceHeight - 90, DeviceWidth - 40, 30);
    [strollBt setTitle:@"先逛逛" forState:UIControlStateNormal];
    [strollBt setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
    [strollBt setTitleColor:RGBA(188, 188, 188, 1) forState:UIControlStateHighlighted];
    strollBt.titleLabel.font = kFont(13);
    [strollBt addTarget:self action:@selector(clickstrollBt) forControlEvents:UIControlEventTouchUpInside];
    strollBt.layer.masksToBounds = YES;
    strollBt.layer.cornerRadius = 15;
    strollBt.layer.borderColor = [UIColor whiteColor].CGColor;
    strollBt.layer.borderWidth = 1;
    [_hintImgView addSubview:strollBt];
    
    CGFloat w =( DeviceWidth - 20 -20 -20 )/2;
    
    UIButton *loginBt = [UIButton buttonWithType:UIButtonTypeCustom];
    loginBt.frame = CGRectMake(20, DeviceHeight - 50, w, 40);
    [loginBt setTitle:@"登录" forState:UIControlStateNormal];
    loginBt.backgroundColor = RGBA(34, 34, 50, 1);
    [loginBt setTitleColor:RGBA(255, 255, 255, 0.5) forState:UIControlStateNormal];
    [loginBt setTitleColor:RGBA(188, 188, 188, 1) forState:UIControlStateHighlighted];
    loginBt.titleLabel.font = kFont(13);
    [loginBt addTarget:self action:@selector(clickloginBt) forControlEvents:UIControlEventTouchUpInside];
    loginBt.layer.masksToBounds = YES;
    loginBt.layer.cornerRadius = 20;
    
    [_hintImgView addSubview:loginBt];
    
    
    UIButton *rBt = [UIButton buttonWithType:UIButtonTypeCustom];
    rBt.frame = CGRectMake(20+w+20, DeviceHeight - 50, w, 40);
    [rBt setTitle:@"注册" forState:UIControlStateNormal];
    rBt.backgroundColor = RGBA(120, 120, 120, 1);
    [rBt setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
    [rBt setTitleColor:RGBA(188, 188, 188, 1) forState:UIControlStateHighlighted];
    rBt.titleLabel.font = kFont(13);
    [rBt addTarget:self action:@selector(clickrBt) forControlEvents:UIControlEventTouchUpInside];
    rBt.layer.masksToBounds = YES;
    rBt.layer.cornerRadius = 20;
    
    [_hintImgView addSubview:rBt];
}
//注册
- (void)clickrBt
{
    RegisterViewController *registerVC = [[RegisterViewController alloc] init];
    UINavigationController *naVC = [[UINavigationController alloc] initWithRootViewController:registerVC];
    registerVC.hidesBottomBarWhenPushed = YES;
    [self presentViewController:naVC animated:YES completion:^{
        
    }];
    
}

//先逛逛
- (void)clickstrollBt
{
    //  [homeVc clickstrollBt];
    RecommendViewController *reVC = [[RecommendViewController alloc] init];
    reVC.special = YES;
    UINavigationController *naVC = [[UINavigationController alloc] initWithRootViewController:reVC];
    
    [self presentViewController:naVC animated:YES completion:^{
        
        
    }];
}
//登录
- (void)clickloginBt
{
    // [homeVc clickBt];
    
    LoginViewController *login = [[LoginViewController alloc]init];
    //    login.modalPresentationStyle = UIModalPresentationFormSheet;
    UINavigationController *naVC = [[UINavigationController alloc] initWithRootViewController:login];
    login.hidesBottomBarWhenPushed = YES;
    [self presentViewController:naVC animated:YES completion:^{
        
    }];
    
    
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    if ([self isViewLoaded]&&!self.view.window) {
        self.view = nil;
    }
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
